from django.urls import path
from . import views

urlpatterns = [
    path('', views.product_list, name='product_list'),
    path('category/<int:category_id>/', views.category_view, name='category'),
    path('subcategory/<int:subcategory_id>/', views.subcategory_view, name='subcategory'),
    path('type/<int:product_type_id>/', views.product_type_view, name='product_type'),
    path('detail/<int:product_id>/', views.product_detail, name='product_detail'),
    path('search/', views.search, name='search'),
    path('new/', views.new_products, name='new_products'),
    path('sale/', views.on_sale_products, name='on_sale_products'),
    
    # 购物车相关路由
    path('cart/', views.view_cart, name='view_cart'),
    path('cart/add/<int:product_id>/', views.add_to_cart, name='add_to_cart'),
    path('cart/update/<int:item_id>/', views.update_cart, name='update_cart'),
    path('cart/remove/<int:item_id>/', views.remove_from_cart, name='remove_from_cart'),
    path('cart/toggle-select/<int:item_id>/', views.toggle_select_cart_item, name='toggle_select_cart_item'),
    path('cart/clear/', views.remove_from_cart_all, name='clear_cart'),
    path('checkout/', views.checkout_redirect, name='checkout_redirect'),
]